//
//  UIImageAdditions.h
//  Tint
//
//  Created by Kevin Wu on 2/22/12.
//  Copyright (c) 2012 Telligenty. All rights reserved.
//

#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>


typedef enum {
    TTImageRoundCornerModeAll = 0, 
    TTImageRoundCornerModeLeft, 
    TTImageRoundCornerModeTop, 
    TTImageRoundCornerModeRight, 
    TTImageRoundCornerModeBottom, 
    TTImageRoundCornerModeLeftTop, 
    TTImageRoundCornerModeTopRight, 
    TTImageRoundCornerModeRightBottom, 
    TTImageRoundCornerModeBottomLeft
} TTImageRoundCornerMode;

typedef enum {
	TTImageCropModeTopLeft = 0,
	TTImageCropModeTopCenter,
	TTImageCropModeTopRight,
	TTImageCropModeBottomLeft,
	TTImageCropModeBottomCenter,
	TTImageCropModeBottomRight,
	TTImageCropModeLeftCenter,
	TTImageCropModeRightCenter,
	TTImageCropModeCenter
} TTImageCropMode;


@interface UIImage (Tint)

/*
 * Creating
 */
+ (UIImage *)imageWithColor:(UIColor *)color size:(CGSize)size;

/*
 * Stretchable image
 */
- (UIImage *)stretchableImage;
- (UIImage *)stretchableImageWithCenterSize:(CGSize)size;
- (UIImage *)widthStretchableImage;
- (UIImage *)widthStretchableImageWithCenter:(CGFloat)center;
- (UIImage *)widthStretchableImageWithLeft:(CGFloat)left right:(CGFloat)right;
- (UIImage *)heightStretchableImage;
- (UIImage *)heightStretchableImageWithCenter:(CGFloat)center;
- (UIImage *)heightStretchableImageWithTop:(CGFloat)top bottom:(CGFloat)bottom;
- (UIImage *)stretchableImageWithCapInsets:(UIEdgeInsets)capInsets;

/*
 * Round corner
 */
- (UIImage *)makeRoundCornersOfSize:(CGSize)cornerSize; // All
- (UIImage *)makeRoundCornersOfSize:(CGSize)cornerSize usingMode:(TTImageRoundCornerMode)mode;

/*
 * Cropping
 */
- (UIImage *)cropCenter;
- (UIImage *)cropToSize:(CGSize)newSize; // TopLeft
- (UIImage *)cropToSize:(CGSize)newSize usingMode:(TTImageCropMode)mode;
- (UIImage *)cropAt:(CGRect)rect;

/*
 * Scaling
 */
- (UIImage *)scaleToFitSize:(CGSize)bounds;
- (UIImage *)scaleByFactor:(CGFloat)factor;
- (UIImage *)scaleToSize:(CGSize)size;

/*
 * Merging
 */
- (UIImage *)mergeWithImage:(UIImage *)image;
- (UIImage *)mergeAtCenterWithImage:(UIImage *)image;
- (UIImage *)mergeWithImage:(UIImage *)image atPoint:(CGPoint)point;

/*
 * Masking
 */
- (UIImage *)maskWithImage:(UIImage *)image;

/*
 * Filtering
 */
- (UIImage *)sepia;
- (UIImage *)grayscale;
- (UIImage *)negative;

@end
